import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '深色模式',
      // 普通模式主题
      theme: ThemeData(
        primarySwatch: Colors.yellow,
        textTheme: TextTheme(
            bodyText2: TextStyle(
          fontSize: 20,
          color: Colors.red,
        )),
      ),
      // 深色模式样式
      darkTheme: ThemeData(
          primarySwatch: Colors.grey,
          textTheme: TextTheme(
              bodyText2: TextStyle(
            fontSize: 30,
            color: Colors.green,
          ))),
      home: Scaffold(
        appBar: AppBar(
          title: Text('深色模式'),
        ),
        body: HomePage(),
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
        child: Column(
      children: [
        Container(
          width: 200,
          height: 200,
          child: Text('暗黑模式'),
        ),
      ],
    ));
  }
}
